#include <stdio.h>
#include <stdlib.h>

#define MAXSIZE 10

typedef int ElemType;
typedef struct
{
  ElemType data[MAXSIZE];
  int front, rear;
} SqQueue;

// 初始化队列
bool InitQueue(SqQueue &q)
{
  q.front = q.rear = 0;
}

// 插入(入队)
bool EnQueue(SqQueue &q, ElemType e)
{
  // 牺牲一个单元来区分的
  if ((q.rear + 1) % MAXSIZE == q.front) // 队满
    return false;
  q.data[q.rear] = e;
  q.rear = (q.rear + 1) % MAXSIZE;
  return true;
}

// 删除(出队)
bool DeQueue(SqQueue &q, ElemType &e)
{
  if (q.rear == q.front)
    return false;
  e = q.data[q.front];
  q.front = (q.front + 1) % MAXSIZE;
  return true;
}

// 判断队空的情况
bool IsEmpty(SqQueue q)
{
  return q.rear == q.front;
}

int main()
{
  SqQueue q;
}